<template>
  <div class="home-echart-list">
    <my-echart class="flex-1" :options="lineOptions" />
    <my-echart class="flex-1" :options="barOptions" />
    <my-echart class="flex-1" :options="pieOptions" />
  </div>
</template>

<script setup lang="ts">
import MyEchart from '@/components/echarts/MyEchart.vue'
import { reactive } from 'vue'
// 折线图
const lineOptions = reactive({
  title: {
    text: '折线图',
    top: '10',
    left: '10'
  },
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
})
// 柱状图
const barOptions = reactive({
  title: {
    text: '柱状图',
    top: '10',
    left: '10'
  },
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'bar',
      showBackground: true,
      backgroundStyle: {
        color: 'rgba(180, 180, 180, 0.2)'
      }
    }
  ]
})
// 饼图
const pieOptions = reactive({
  title: {
    text: '饼图',
    top: '10',
    left: '10'
  },
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: '50%',
      data: [
        { value: 1048, name: 'Search Engine' },
        { value: 735, name: 'Direct' },
        { value: 580, name: 'Email' },
        { value: 484, name: 'Union Ads' },
        { value: 300, name: 'Video Ads' }
      ],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      }
    }
  ]
})
</script>

<style lang="scss" scoped>
.home-echart-list {
  display: flex;
}
</style>
